

 
use RFS_master_data, clear

* loop over the different transaction cost specifications

    global vars3 "    N_aver  N_coun  N_3hour N_BuSe N_IDB  "  

	   foreach j of global vars3 {

cap drop aux_size 
cap drop aux_P0
   gen aux_size = size
   gen aux_P0  = `j'   
  cap drop res_*
   reghdfe aux_P0    , absorb(call     )  resid(res_aux_P0)  
   reghdfe aux_size     , absorb(call     )  resid(res_size)  

     	qui winsor2 res_aux_P0 , replace cuts(1 99)
     	qui winsor2 res_size   , replace cuts(1 99)
     	qui winsor2 aux_size   , replace cuts(1 99)
  
 tw   lfitci  aux_P0 aux_size     ,  ciplot(rline) lcolor(gs0)  blpattern(dash) blcolor(gs12) ///
title("Pooled Regression", size( large)) legend(off)  ///
ytitle("Trading Cost", size(large)) graphregion(color(white))  xtitle("Trade Size", size(large)) name("ff1",replace)  
     
   tw  lfitci  res_aux_P0 res_size     ,  ciplot(rline) lcolor(gs0)  blpattern(dash) blcolor(gs12)  ///
title("Controlling for Client Identities", size( large )) legend(off)  ///
ytitle("Trading Cost", size(large))  graphregion(color(white))  xtitle("Trade Size", size(large)) name("ff2",replace)  
  
  graph combine ff1 ff2  ,   graphregion(color(white)) name("fig_new", replace)
 
    graph combine ff1 ff2  , ycommon    graphregion(color(white)) name("fig_`j'", replace)
   graph export "Apr15_Size_Figure1_`j'.pdf", replace
   
   }


    